package com.atguigu.tingshu.album.mapper;

import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.album.AlbumInfo;
import com.atguigu.tingshu.query.album.AlbumInfoQuery;
import com.atguigu.tingshu.vo.album.AlbumListVo;
import com.atguigu.tingshu.vo.album.AlbumStatVo;
import com.atguigu.tingshu.vo.album.TrackStatMqVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface AlbumInfoMapper extends BaseMapper<AlbumInfo> {

    /**
     * 查询用户专辑分页列表
     * @param albumListVoPage   封装了pageNo与pageSize的分页对象,在mybatis-plus中有分页插件对象！
     * @param albumInfoQuery
     * @return
     */
    IPage<AlbumListVo> selectUserAlbumPage(Page<AlbumListVo> albumListVoPage,@Param("vo") AlbumInfoQuery albumInfoQuery);

    /**
     * 根据专辑Id 获取到统计数据
     * @param albumId
     * @return
     */
    AlbumStatVo selectAlbumStat(Long albumId);

    /**
     * 修改专辑播放数
     * @param albumId
     * @param statPlay
     */
    @Update("update album_stat set stat_num = stat_num + 1 where album_id = #{albumId} and stat_type = #{statPlay} and is_deleted = 0")
    int updateAlbumStat(@Param("albumId") Long albumId, @Param("statPlay")String statPlay);



}
